# Date interval

import datetime

date1 = input() # '12 August, 2022'

day1 = int(date1.split(' ')[0])
month1 = date1.split(' ')[1]
year1 = int(date1.split(' ')[2])

date2 = input() # '31 December, 2022'

day2 = int(date2.split(' ')[0])
month2 = date2.split(' ')[1]
year2 = int(date2.split(' ')[2])

months = {'January,' : 1, 'February,' : 2, 'March,' : 3, 'April,' : 4, 'May,' : 5, 'June,' : 6, 'July,' : 7, 'August,' : 8, 'September,' : 9, 'October,' : 10, 'November,' : 11, 'December,' : 12}

dstart = datetime.datetime(year1, months[month1], day1)
dend = datetime.datetime(year2, months[month2], day2)

interval = (dend - dstart).days

print(interval)